export function setupPermission(app) {
  ////按钮权限
  app.directive("permission", {
    mounted(el, binding) {
      let type = binding.value || "";
      let status = false;
      ////获取当前的this实例
      let vm = binding.instance;
      ////当前菜单对应的路由信息
      let route = vm.$route;
      ///根据路由信息获取菜单权限信息,可获取到当前菜单的所有信息
      ///这里表示用户所拥有的所有权限
      let permissionBtns = localStorage.getItem("btnPermission")?.split(",");
      permissionBtns?.forEach((item) => {
        if (type == Number(item)) {
          status = true;
        }
      });
      if (!status) {
        el.style.display = "none";
      }
    },
  });
}
